package cn.cnhis.online.base;

import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;

public abstract class BaseFragment extends Fragment {

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        init();
        initListener();
    }

    public abstract void initListener();

    public abstract void init();

    /*携带数据跳转*/
    public void startOterActivity(Activity activity, Class cls, Bundle bundle, String key) {
        Intent intent = new Intent(activity, cls);
        intent.putExtra(key, bundle);
        startActivity(intent);
    }

    public void startOterActivity(Activity activity, Class cls, Bundle bundle, String key, int requestCode) {
        Intent intent = new Intent(activity, cls);
        intent.putExtra(key, bundle);
        startActivityForResult(intent, requestCode);
    }
}
